using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Mail;
using System.Net;
namespace zCO
{
    public static class Mailing
    {
        public static void SendMail(string pSubject, string pContents, string pMailFrom, string pMailAdressTo, bool isHTML)
        {
            MailMessage correo = new MailMessage();
            correo.From = new MailAddress(pMailFrom);
            correo.Subject = pSubject;
            correo.Body = pContents;
            correo.IsBodyHtml = isHTML;
            correo.Priority = MailPriority.Normal;
            correo.To.Add(pMailAdressTo);
            SendMail(correo);
        }

        /// <summary>
        /// Envia un mail y permite adjuntar un archivo. 
        /// </summary>    
        public static void SendMail(string pSubject, string pContents, string pMailFrom, string pMailAdressTo, string attachFile)
        {
            MailMessage correo = new MailMessage();
            correo.From = new MailAddress(pMailFrom);
            correo.Subject = pSubject;
            correo.Body = pContents;
            correo.IsBodyHtml = true;
            correo.Priority = MailPriority.Normal;
            correo.To.Add(pMailAdressTo);
            correo.Attachments.Add(new Attachment(attachFile));
            SendMail(correo);
        }
        public static void SendMail(string pSubject, string pContents, string pMailFrom, string pMailAdressTo)
        {
            MailMessage correo = new MailMessage();
            correo.From = new MailAddress(pMailFrom);
            correo.Subject = pSubject;
            correo.Body = pContents;
            correo.IsBodyHtml = true;
            correo.Priority = MailPriority.Normal;
            correo.To.Add(pMailAdressTo);
            SendMail(correo);
        }
        private static void SendMail(MailMessage correo)
        {
            SmtpClient smtp = new SmtpClient();
            smtp.Host = "smtp.arnet.com.ar";
            smtp.Credentials = new NetworkCredential("paliza@arnet.com.ar", "bb07a5a8");
            smtp.Timeout = 3000000;
            smtp.Send(correo);
        }

    }
}